package com.sanji.sjmallutils;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;

import com.sanji.sjmallapp.R;

/**
 * 网络加载等待框
 * Created by zsf on 16-12-10.
 */

public class WaitDialog extends Dialog {

    public WaitDialog(Context context) {
        this(context, R.style.WaitDialog);
    }

    private WaitDialog(Context context, int theme) {
        super(context, theme);
        this.setContentView(R.layout.dialog_loading_layout);
        this.getWindow().getAttributes().gravity = Gravity.CENTER;
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        if (!hasFocus) {
            dismiss();
        }
    }
}
